#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableAutoChessGradeDao:DaoBase<TableAutoChessGrade>
    {
        public override string GetFileName()
        {
            return "TableAutoChessGrade.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableAutoChessGrade>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableAutoChessGrade model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.grade)) UnityEngine.Debug.LogError("数据表id重复:TableAutoChessGrade->id: " + model.grade);
            #endif
            cachePrimaryInt[model.grade] = model;
        }
        protected override TableAutoChessGrade ParseRowData(string[] rowData)
        {
            TableAutoChessGrade data = new TableAutoChessGrade();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.grade = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.rankType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.minScore = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.maxScore = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.weekReward = rowData[4];
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.seasonReward = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.gradeTypeName = rowData[6];
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.gradeName = rowData[7];
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.subGradeType = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.gradeIconSmall = rowData[9];
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.gradeIcon = rowData[10];
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.gradeTextIcon = rowData[11];
            }
            return data;
        }
    }
}
